package gui;

import java.awt.EventQueue;

import javax.swing.JFrame;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.Font;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class SeatHandler {

	private JFrame frmSeatReservation;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					SeatHandler window = new SeatHandler();
					window.frmSeatReservation.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public SeatHandler() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmSeatReservation = new JFrame();
		frmSeatReservation.setTitle("Seat Reservation");
		frmSeatReservation.setBounds(100, 100, 450, 442);
		frmSeatReservation.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JLabel SelectInstructions = new JLabel("Please select the available (green) seat you would like to reserve.");
		SelectInstructions.setFont(new Font("Century Gothic", Font.PLAIN, 13));
		
		JLabel SelectLabel = new JLabel("Reserve Your Desired Seat");
		SelectLabel.setFont(new Font("Century Gothic", Font.BOLD, 18));
		
		JButton SubmitSeatButton = new JButton("Submit Seat Selection");
		SubmitSeatButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				//if green seat not selected, trigger alert to select green seat
				
				
				//if green seat, trigger seat selection success window
			}
		});
		SubmitSeatButton.setFont(new Font("Century Gothic", Font.PLAIN, 16));
		GroupLayout groupLayout = new GroupLayout(frmSeatReservation.getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(102)
							.addComponent(SelectLabel))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(7)
							.addComponent(SelectInstructions))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(117)
							.addComponent(SubmitSeatButton)))
					.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(SelectLabel)
					.addGap(11)
					.addComponent(SelectInstructions)
					.addPreferredGap(ComponentPlacement.RELATED, 301, Short.MAX_VALUE)
					.addComponent(SubmitSeatButton)
					.addContainerGap())
		);
		frmSeatReservation.getContentPane().setLayout(groupLayout);
	}
}
